package com.order.server;

import com.order.feign.MemberApifeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @auther: wuyiyong
 * @Desrciption:
 * @Date: Created in 10:54 2019/1/2
 */
@RestController
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private MemberApifeign memberApifeign;

    @RequestMapping("/getorder")
    public String getOrder() {
        // order 使用rpc 远程调用技术 调用 会员服务
        String memberUrl = "http://member/getMember";
        String result = restTemplate.getForObject(memberUrl, String.class);
        System.out.println("会员服务调用订单服务,result:" + result);
        return result;
    }

    @RequestMapping("/feignMember")
    public String feignMember() {
        return memberApifeign.getMember();
    }

}
